<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>react示例</title>
</head>
<body>
  <div id="app"></div>
  <!-- 两个都要引入，而且要注意顺序 -->
  <!-- 核心库 -->
  <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
  <!-- 操作dom -->
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
  <script>
    // ReactDOM.render(
    //   // 要渲染的元素
    //   React.createElement(
    //     'h1', null, 'hello react'
    //   ),document.getElementById('app')
    // )
    // =====================
    // 1. 先创建元素
    // React.createElement方法的三个参数：标签名，标签属性（对象）， 标签内容
    let elMark1 = React.createElement('mark', {className:'m1', id: 'm2', 'new-prop': 666}, '我是11一个mark标签！！！');
    let elMark2 = React.createElement('mark', {className:'m1', id: 'm2', 'new-prop': 666}, '我是22一个mark标签！！！');
    let elDiv = React.createElement('div', {className:'div1'}, elMark1,elMark2);
    // 创建出来的元素，都是obj对象
    console.log(typeof elDiv);
    // 2. 渲染元素
    let rootDom = document.getElementById('app');
    // ReactDOM.render方法两个参数：要渲染的元素，容器
    ReactDOM.render(elDiv, rootDom);
  </script>
</body>
</html>